package fr.vvins.core.user.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import fr.vvins.core.user.entity.UserComment;

public interface UserCommentRepository extends CrudRepository<UserComment, Integer> {

	@Query("from UserComment where product.id=?1")
	List<UserComment> findByProductId(Integer id);

	@Query("from UserComment where vigneron.id=?1")
	List<UserComment> findByVigneronId(Integer id);

	@Query("from UserComment where product.content.id=?1")
	List<UserComment> findByProductContentId(Integer id);

	@Query("from UserComment where vigneron.content.id=?1")
	List<UserComment> findByVigneronContentId(Integer id);

	@Query("from UserComment where product.content.key=?1")
	List<UserComment> findByProductContentKey(String key);

	@Query("from UserComment where vigneron.content.key=?1")
	List<UserComment> findByVigneronContentKey(String key);

	@Query("from UserComment where user.id=?1")
	List<UserComment> findByUserId(Integer userId);

}
